import request from '@/utils/request'


export function saveOrder(user) {
  return request({
    url: 'order/save/',
    method: 'post',
    data: user
  })
}

export function save(id) {
  return request({
    url: `order/seckill/${id}`,
    method: 'post'
  })
}

export function listOrder() {
  return request({
    url: 'order/list',
    method: 'get',
  })
}

export function listSellerOrder() {
  return request({
    url: '/order/sellerList',
    method: 'get',
  })
}

export function payOrder(payOrderId) {
  const data = {
    "order_id": payOrderId,
    "status": 1
  };
  var res = request({
    url: '/order/setStatus',
    method: 'post',
    data: data
  });
  return res
}

// 出库
export function delivery(payOrderId) {
  const data = {
    "order_id": payOrderId,
    "status": 3
  };
  var res = request({
    url: '/order/setStatus',
    method: 'post',
    data: data
  });
  return res
}

// 送达
export function delivery2(payOrderId) {
  const data = {
    "order_id": payOrderId,
    "status": 4
  };
  var res = request({
    url: '/order/setStatus',
    method: 'post',
    data: data
  });
  return res
}

// 收货
export function confirm(payOrderId) {
  const data = {
    "order_id": payOrderId,
    "status": 5
  };
  var res = request({
    url: '/order/setStatus',
    method: 'post',
    data: data
  });
  return res
}